﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Configuration;


namespace FNFSync
{
    public partial class Preferences : Form
    {
        public Preferences()
        {
            InitializeComponent();
        }

        private void Preferences_Load(object sender, EventArgs e)
        {
            switch (FNFSync.Properties.Settings.Default.SyncDirections)
            {
                case "Sync Down":
                    rbtnSyncDown.Checked = true;
                    break;
                case "Sync Up":
                    rBtnSyncUp.Checked = true;
                    break;
                case "Two Way Sync":
                    rBtn2WaySync.Checked = true;
                    break;
            }

            switch (FNFSync.Properties.Settings.Default.SyncOptions)
            {
                case "Copy Non-Existent":
                    rBtnCopyNonExistent.Checked = true;
                    break;
                case "Overwrite Older Version":
                    rBtnOverwriteOlderVersion.Checked = true;
                    break;
                case "Always Overwrite":
                    rBtnAlwaysOverwrite.Checked = true;
                    break;
            }

            switch (FNFSync.Properties.Settings.Default.VerboseLevel)
            {
                case "Level 1":
                    rBtnL1.Checked=true;
                    break;
                case "Level 2":
                    rBtnL2.Checked=true;
                    break;
                case "Level 3":
                    rBtnL3.Checked=true;
                    break;
            }
        }

        private void rbtnSyncDown_CheckedChanged(object sender, EventArgs e)
        {
            if (rbtnSyncDown.Checked)
            {
                FNFSync.Properties.Settings.Default.SyncDirections = "Sync Down";
                string tttt = FNFSync.Properties.Settings.Default.SyncDirections;
                FNFSync.Properties.Settings.Default.Save();
            }
        }

        private void rBtnSyncUp_CheckedChanged(object sender, EventArgs e)
        {
            if (rBtnSyncUp.Checked)
            {
                FNFSync.Properties.Settings.Default.SyncDirections = "Sync Up";
                string tttt = FNFSync.Properties.Settings.Default.SyncDirections;
                FNFSync.Properties.Settings.Default.Save();
            }
        }

        private void rBtn2WaySync_CheckedChanged(object sender, EventArgs e)
        {
            if (rBtn2WaySync.Checked)
            {
                FNFSync.Properties.Settings.Default.SyncDirections = "Two Way Sync";
                string tttt = FNFSync.Properties.Settings.Default.SyncDirections;
                FNFSync.Properties.Settings.Default.Save();
            }
        }

        private void rBtnCopyNonExistent_CheckedChanged(object sender, EventArgs e)
        {
            if (rBtnCopyNonExistent.Checked)
            {
                FNFSync.Properties.Settings.Default.SyncOptions = "Copy Non-Existent";
                string tttt = FNFSync.Properties.Settings.Default.SyncOptions;
                FNFSync.Properties.Settings.Default.Save();
            }
        }

        private void rBtnOverwriteOlderVersion_CheckedChanged(object sender, EventArgs e)
        {
            if (rBtnOverwriteOlderVersion.Checked)
            {
                FNFSync.Properties.Settings.Default.SyncOptions = "Overwrite Older Version";
                string tttt = FNFSync.Properties.Settings.Default.SyncOptions;
                FNFSync.Properties.Settings.Default.Save();
            }
        }

        private void rBtnAlwaysOverwrite_CheckedChanged(object sender, EventArgs e)
        {
            if (rBtnAlwaysOverwrite.Checked)
            {
                FNFSync.Properties.Settings.Default.SyncOptions = "Always Overwrite";
                string tttt = FNFSync.Properties.Settings.Default.SyncOptions;
                FNFSync.Properties.Settings.Default.Save();
            }
        }

        private void rBtnL1_CheckedChanged(object sender, EventArgs e)
        {
            if (rBtnL1.Checked)
            {
                FNFSync.Properties.Settings.Default.VerboseLevel = "Level 1";
                string tttt = FNFSync.Properties.Settings.Default.VerboseLevel;
                FNFSync.Properties.Settings.Default.Save();
                
            }
        }

        private void rBtnL2_CheckedChanged(object sender, EventArgs e)
        {
            if (rBtnL2.Checked)
            {
                FNFSync.Properties.Settings.Default.VerboseLevel = "Level 2";
                string tttt = FNFSync.Properties.Settings.Default.VerboseLevel;
                FNFSync.Properties.Settings.Default.Save();
            }
        }

        private void rBtnL3_CheckedChanged(object sender, EventArgs e)
        {
            if (rBtnL3.Checked)
            {
                FNFSync.Properties.Settings.Default.VerboseLevel = "Level 3";
                string tttt = FNFSync.Properties.Settings.Default.VerboseLevel;
                FNFSync.Properties.Settings.Default.Save();
            }
        }
    }
}
